using System;
using System.Collections.Generic;
using System.Text;
using Barrage.Audios;

namespace Barrage
{
    /// <summary>
    /// Base class for playable audio elements
    /// </summary>
    public abstract class Audio:IDisposable
    {
        /// <summary>
        /// Gets/Sets if the sound will loop
        /// </summary>
        public abstract bool Loop { get;set;}
        /// <summary>
        /// Gets/Sets the relative frequency of the sound (1 is original speed)
        /// </summary>
        public abstract float Speed { get;set;}
        /// <summary>
        /// Relative volume of the sound (1 is the original volume)
        /// </summary>
        public abstract float Volume { get;set;}
        /// <summary>
        /// Returns true if the sound is currently being played
        /// </summary>
        public abstract bool Playing { get; }

        /// <summary>
        /// Play the sound
        /// </summary>
        public abstract void Start();
        /// <summary>
        /// Stop the sound
        /// </summary>
        public abstract void Stop();

        /// <summary>
        /// \internal Updates buffers, matrices, etc.
        /// </summary>
        /// <param name="item">Item that's used as the audio holder</param>
        public abstract void Update(Item item);

        /// <summary>
        /// \internal Free resources
        /// </summary>
        public virtual void Dispose()
        {
            NLog.LogManager.GetLogger(ToString()).Debug("Disposed");
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Destructor. Free resources
        /// </summary>
        ~Audio()
        {
            Dispose();
        }
        
    }
}
